package io.datajek.springbasics.movierecommendersystem.lesson9;

import io.datajek.springbasics.movierecommendersystem.lesson2.Filter;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

@Component
@Scope(value=ConfigurableBeanFactory.SCOPE_SINGLETON,proxyMode = ScopedProxyMode.TARGET_CLASS)
@Qualifier("cbf")
public class ContentBasedFilter implements Filter {
    private static int instance=0;
    private Movie movie;

    public ContentBasedFilter(Movie movie) {
        super();
        instance++;
        this.movie=movie;
        System.out.println("ContentBasedFilter constructor called");
    }
    public Movie getMovie(){
        return movie;
    }
    public static int getInstance(){
        return instance;
    }

    public String[] getRecommendations(String movie){

        //基于内容的过滤器的逻辑

        //return movie recommendations
        return new String[]{"逃学威龙","逃学威龙2","ice age"};
    }

}
